package com.os.ch2.profile;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @Author Matt
 * @Date 2022-01-11
 * @Desc:
 * @Version V1.0
 */
public class Main {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        context.getEnvironment().setActiveProfiles("dev");  //先将活动的peofile设置为prod
        context.register(ProfileConfig.class);  //后注册bean配置类，不然会报bean未定义的错误
        context.refresh();  //刷新容器

        DemoBean demoBean = context.getBean(DemoBean.class);

        System.out.println(demoBean.getContent());

        context.close();

    }
}
